package com.dj.mingkong.common.microservice;

import org.apache.logging.log4j.ThreadContext;

public enum LoggerContext {
    ;

    private LoggerContext() {
    }

    public Long getRequestUserId() {
        String userId = ThreadContext.get("req.userId");
        return userId != null ? Long.valueOf(userId) : null;
    }

    public String getRequestUserCode() {
        return ThreadContext.get("req.userCode");
    }

    public String getRequestUserIdString() {
        return ThreadContext.get("req.userId");
    }

    public String getRequestTerminalTypeString() {
        return ThreadContext.get("req.terminal.type");
    }

    public static String getRequestId() {
        return ThreadContext.get("req.requestId");
    }

    public static void setRequestId(String requestId) {
        ThreadContext.put("req.requestId", requestId);
    }

    public String getRequestOpenId() {
        return ThreadContext.get("req.openId");
    }

    public String getRequestUserType() {
        return ThreadContext.get("req.userType");
    }

    public String getRemoteIp() {
        return ThreadContext.get("req.remoteIp");
    }
}

